package com.xxx.corejava.day1030;

import java.util.Scanner;

public class Test4 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);

//        System.out.println("输入成绩【0-100】：");
//
//        int score=sc.nextInt();
//
//        System.out.println("score = " + score);
//
//        //如果输入的分数不符合[0,100]
//        while(score<0 || score>100){
//            System.out.println("分数无效，重新输入：");
//            score=sc.nextInt();
//        }
        int score;
        do{
            System.out.println("输入成绩【0-100】：");
            score=sc.nextInt();
        }while (score<0||score>100);




        System.out.println("判断等级");


        String level;

        switch (score/10){
            case 10 :
                level="A";
                System.out.println("10");
                break;
            case 9 :
                level="A";
                System.out.println("9");
                break;
            case 8 :
                level="B";
                System.out.println("8");
                break;
            case 7 :
                level="C";
                System.out.println("7");
                break;
            case 6 :
                level="D";
                System.out.println("6");
                break;
            default:
                level="E";
                System.out.println("default");
        }


        System.out.println("等级为："+level);


    }
}
